/*
 * @Date: 2022-09-16 09:09:48
 * @LastEditTime: 2022-09-16 09:22:36
 */
import Vue from 'vue'
// import { createRouter, createWebHistory } from 'vue-router';
import Router from 'vue-router'
Vue.use(Router)
import { staticRoutes } from './routes'

const createRouter = () => new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: staticRoutes
})
const router = createRouter()



// const router = createRouter({
//   history: createWebHistory(),
//   routes: staticRoutes,
//   scrollBehavior() {
//     return { top: 0, left: 0 }
//   },
// })

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
